import {defineStore} from "pinia";

export const useMyStore = defineStore('myStore',{
    state:()=>({
        counter:1,
        // token:"24321414"
    }),
    getters:{
        doubleCounter:(state)=>state.counter*2
    },
    actions:{
        add(){
            this.counter++
        }
    },
    persist:{
        // 默认全部存入
        // storage:persistedState.localStorage // 存储  LocalStorage
        // storage:persistedState.sessionStorage // 存储 session
        // storage:persistedState.cookiesWithOptions() // 存储 cookie

        // 只存指定值
        // paths:['token']
    }
})